package org.practice.action;


import org.apache.commons.dbcp.BasicDataSource;
import org.practice.dao.CategoryDao;
import org.practice.model.Category;
import org.practice.util.ServiceProvider;
import org.practice.util.ShopDaoFactory;

@SuppressWarnings("serial")
public class CategoryAction extends BaseAction{
	private Category category=null;
	@Override
	public String execute()throws Exception {
		BasicDataSource dataSource =(BasicDataSource) ServiceProvider.getService("dataSource");// 硬编码方式手工获取Bean
		System.out.println("url:"+dataSource.getUrl());
		CategoryDao dao=ShopDaoFactory.createCategoryDao();
		category=dao.findCategoryById(Category.BOOK_ID);
		return SUCCESS;
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	
}
